package com.xfcy.blog.controller.system;



import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.xfcy.blog.annotation.OperationLogger;
import com.xfcy.blog.common.R;
import com.xfcy.blog.service.CommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 评论表(Comment)表控制层
 *
 * @author 晓风残月Lx
 * @since 2023-04-09 11:03:05
 */
@RestController
@RequestMapping("system/comment")
@Api(tags = "评论后台管理")
public class CommentController {

    @Resource
    private CommentService commentService;

    @GetMapping("/list")
    @SaCheckLogin
    @ApiOperation(value = "评论列表", httpMethod = "GET", response = R.class, notes = "评论列表")
    public R list(Integer pageNo, Integer pageSize, String keywords, @RequestParam(required = false) Integer isDeleted) {
        return commentService.listComment(pageNo, pageSize, keywords, isDeleted);
    }

    @OperationLogger(value = "批量删除评论")
    @RequestMapping(value = "/deleteBatch",method = RequestMethod.DELETE)
    @SaCheckPermission("/system/comment/deleteBatch")
    @ApiOperation(value = "批量删除评论", httpMethod = "DELETE", response = R.class, notes = "批量删除评论")
    public R deleteBatch(@RequestBody List<Long> ids) {
        return commentService.deleteBatchComment(ids);
    }

}

